<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\BaseController;
use Illuminate\Http\Request;

/**
 * @package App\Http\Controllers\Api
 * @see ReplyController
 */
class ReplyController extends BaseController
{

    /**
     * add
     * @uri /reply/add
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"parent_id":"0DB197160731D5B8","content":"D8871107AC1F2B94"}
     * @response {"success":true,"statusCode":200,"result":{"id":"24\u4f4d\u56de\u590dID","content":"\u56de\u590d\u5185\u5bb9","is_deleted":0,"is_like":false,"created_at":1599198791,"user":{"id":"24\u4f4d\u7528\u6237ID","nickname":"\u7528\u6237\u6635\u79f0","avatar":"\u5934\u50cf","attention_status":"\u5173\u6ce8\u72b6\u6001\uff0c1\u6ca1\u5173\u6ce8\uff0c2\u5173\u6ce8\u4e86\uff0c3\u81ea\u5df1\uff0c4\u4e92\u5173"},"to_user":{"id":"24\u4f4d\u7528\u6237ID","nickname":"\u7528\u6237\u6635\u79f0","avatar":"\u5934\u50cf","attention_status":"\u5173\u6ce8\u72b6\u6001\uff0c1\u6ca1\u5173\u6ce8\uff0c2\u5173\u6ce8\u4e86\uff0c3\u81ea\u5df1\uff0c4\u4e92\u5173"},"count":{"reply":0,"like":0}},"message":"OK"}
     */
    public function add(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":{"id":"24\u4f4d\u56de\u590dID","content":"\u56de\u590d\u5185\u5bb9","is_deleted":0,"is_like":false,"created_at":1599198791,"user":{"id":"24\u4f4d\u7528\u6237ID","nickname":"\u7528\u6237\u6635\u79f0","avatar":"\u5934\u50cf","attention_status":"\u5173\u6ce8\u72b6\u6001\uff0c1\u6ca1\u5173\u6ce8\uff0c2\u5173\u6ce8\u4e86\uff0c3\u81ea\u5df1\uff0c4\u4e92\u5173"},"to_user":{"id":"24\u4f4d\u7528\u6237ID","nickname":"\u7528\u6237\u6635\u79f0","avatar":"\u5934\u50cf","attention_status":"\u5173\u6ce8\u72b6\u6001\uff0c1\u6ca1\u5173\u6ce8\uff0c2\u5173\u6ce8\u4e86\uff0c3\u81ea\u5df1\uff0c4\u4e92\u5173"},"count":{"reply":0,"like":0}},"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

    /**
     * del
     * @uri /reply/del
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"id":"1E5C84A7E73F631A"}
     * @response {"success":true,"statusCode":200,"result":true,"message":"OK"}
     */
    public function del(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":true,"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

    /**
     * getList
     * @uri /reply/list
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"comment_id":"ED855763012FEDCF","page":"692091DB29002EA6"}
     * @response {"success":true,"statusCode":200,"result":{"total_count":1,"page_size":10,"page":1,"list":[{"id":"24\u4f4d\u56de\u590dID","content":"\u56de\u590d\u5185\u5bb9","is_deleted":0,"is_like":false,"created_at":1599198791,"user":{"id":"24\u4f4d\u7528\u6237ID","nickname":"\u7528\u6237\u6635\u79f0","avatar":"\u5934\u50cf","attention_status":"\u5173\u6ce8\u72b6\u6001\uff0c1\u6ca1\u5173\u6ce8\uff0c2\u5173\u6ce8\u4e86\uff0c3\u81ea\u5df1\uff0c4\u4e92\u5173"},"to_user":{"id":"24\u4f4d\u7528\u6237ID","nickname":"\u7528\u6237\u6635\u79f0","avatar":"\u5934\u50cf","attention_status":"\u5173\u6ce8\u72b6\u6001\uff0c1\u6ca1\u5173\u6ce8\uff0c2\u5173\u6ce8\u4e86\uff0c3\u81ea\u5df1\uff0c4\u4e92\u5173"},"count":{"reply":0,"like":0}}]},"message":"OK"}
     */
    public function getList(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":{"total_count":1,"page_size":10,"page":1,"list":[{"id":"24\u4f4d\u56de\u590dID","content":"\u56de\u590d\u5185\u5bb9","is_deleted":0,"is_like":false,"created_at":1599198791,"user":{"id":"24\u4f4d\u7528\u6237ID","nickname":"\u7528\u6237\u6635\u79f0","avatar":"\u5934\u50cf","attention_status":"\u5173\u6ce8\u72b6\u6001\uff0c1\u6ca1\u5173\u6ce8\uff0c2\u5173\u6ce8\u4e86\uff0c3\u81ea\u5df1\uff0c4\u4e92\u5173"},"to_user":{"id":"24\u4f4d\u7528\u6237ID","nickname":"\u7528\u6237\u6635\u79f0","avatar":"\u5934\u50cf","attention_status":"\u5173\u6ce8\u72b6\u6001\uff0c1\u6ca1\u5173\u6ce8\uff0c2\u5173\u6ce8\u4e86\uff0c3\u81ea\u5df1\uff0c4\u4e92\u5173"},"count":{"reply":0,"like":0}}]},"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

}